/**
 * @author Juan C. Díaz (juancarlosdiaz@ceteca.net) <br>
 *         Copyright (c) 2009 Fundación Centro Tecnolóxico da Carne
 * 
 * <br>
 * <br>
 *         This program is free software: you can redistribute it and/or modify
 *         it under the terms of the GNU General Public License as published by
 *         the Free Software Foundation, either version 3 of the License, or (at
 *         your option) any later version. <br/>
 *         This program is distributed in the hope that it will be useful, but
 *         WITHOUT ANY WARRANTY 
 *         <br>without even the implied warranty of
 *         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *         General Public License for more details. <br/>
 *         You should have received a copy of the GNU General Public License
 *         along with this program. If not, see <http://www.gnu.org/licenses/>.
 * 
 */





package org.ceteca.explica.core.management;

import java.io.Serializable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.ceteca.explica.core.common.BaseVO;
import org.ceteca.explica.core.extTables.ExtTableOT;

public class DocumentTypeOT extends BaseVO implements Serializable{

	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private long idDocumentType;
	private String description;
	private int documentClass;
	private boolean modifyStock, returnDocument, incrementStock, accountingDocument; 
	private Integer version= new Integer(0);
	private ExtTableOT extTable;
	private ExtTableOT extTableLines;
	private String reportName;
	private String printerName;
	private Boolean preview;
	
	
	
	public Boolean getPreview() {
		return preview;
	}

	public void setPreview(Boolean preview) {
		this.preview = preview;
	}

	public boolean getModifyStock(){
		return isModifyStock();
	}
	
	public boolean getReturnDocument(){
		return isReturnDocument();
	}
	
	public boolean getIncrementStock(){
		return isIncrementStock();
	}
	
	public boolean getAccountingDocument(){
		return isAccountingDocument();
	}
	

	
	
	public void setVersion(Integer version) {
		this.version = version;
	}

	public long getIdDocumentType() {
		return idDocumentType;
	}

	public void setIdDocumentType(long idDocumentType) {
		this.idDocumentType = idDocumentType;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getDocumentClass() {
		return documentClass;
	}

	public void setDocumentClass(int documentClass) {
		this.documentClass = documentClass;
	}

	public boolean isModifyStock() {
		return modifyStock;
	}

	public void setModifyStock(boolean stockModifyDocument) {
		this.modifyStock = stockModifyDocument;
	}

	public boolean isReturnDocument() {
		return returnDocument;
	}

	public void setReturnDocument(boolean returnDocument) {
		this.returnDocument = returnDocument;
	}

	public boolean isIncrementStock() {
		return incrementStock;
	}

	public void setIncrementStock(boolean incrementStock) {
		this.incrementStock = incrementStock;
	}

	public boolean isAccountingDocument() {
		return accountingDocument;
	}

	public void setAccountingDocument(boolean accountingDocument) {
		this.accountingDocument = accountingDocument;
	}


	public Integer getVersion() {
		return version;
	}

	   @Override
	    public int hashCode() {
	        final HashCodeBuilder hcb = new HashCodeBuilder();
	        hcb.append(getDescription());


	        return hcb.toHashCode();
	    }

	    
	    
	    @Override
	    public boolean equals(Object obj) {
	        boolean isEquals = false;
	        try {
	            final DocumentTypeOT other = (DocumentTypeOT)obj;
	            final EqualsBuilder eqb = new EqualsBuilder();
	            eqb.append(getDescription(), other.getDescription());
	            isEquals = eqb.isEquals();

	        } catch (Exception e) {
	            isEquals = false;
	        }

	        return isEquals;
	    }

	@Override
	public String getEntityId() {
		return InterfaceManagement.EXPLICA_ENTITY_DOCUMENTTYPE_ID;
	}

	@Override
	public long getInternalId() {
		return this.getIdDocumentType();
	}

	@Override
	public String getInternalValue() {
		return this.getDescription();
	}

	@Override
	public boolean equals(Long id) {
		return id==this.getIdDocumentType();
	}

	@Override
	public String toString() {
		StringBuilder sb=new StringBuilder();
		sb.append("\n---------- DOCUMENT TYPE -------------");
		sb.append("\nId: "+this.getEntityId());
		sb.append("\n"+this.getDescription()+"\n");
		return sb.toString();
	}

	public ExtTableOT getExtTable() {
		return extTable;
	}

	public void setExtTable(ExtTableOT extTable) {
		this.extTable = extTable;
	}

	public String getReportName() {
		return reportName;
	}

	public void setReportName(String reportName) {
		this.reportName = reportName;
	}

	public ExtTableOT getExtTableLines() {
		return extTableLines;
	}

	public void setExtTableLines(ExtTableOT extTableLines) {
		this.extTableLines = extTableLines;
	}

	public String getPrinterName() {
		return printerName;
	}

	public void setPrinterName(String printerName) {
		this.printerName = printerName;
	}



}
